import { defineConfig} from "vite";
import uni from '@dcloudio/vite-plugin-uni';
import dns from 'dns';
import { resolve } from 'path';
dns.setDefaultResultOrder('verbatim')
export default defineConfig({
	envDir: resolve(__dirname, 'env'), 
	plugins: [
		uni()
	],
	server: {
	    host: '0.0.0.0', // 允许本机
	    port: 8097, // 设置端口
	    cors: true, // 允许跨域
	    proxy: {
	        '/api': {
	            target: 'http://localhost:9999',
	            changeOrigin: true,
	            ws: true,
	            rewrite: (path) => path.replace(/^\/api/, '')
	        },
			'/ai': {
			    target: 'http://61.163.243.7:9999',
			    changeOrigin: true,
			    ws: true,
			    rewrite: (path) => path.replace(/^\/ai/, '')
			}
	    }
	  },
})